/*
 * Copyright (c) 2011 Team A CS2340. All rights reserved.
 */

package edu.gatech.teama.doctorsoffice.client.presenter;


import java.util.List;

 // $codepro.audit.disable importStyle
import edu.gatech.teama.doctorsoffice.model.*; // $codepro.audit.disable importStyle


/**
 * MedicalHistoryReport.java
 * shows medical history
 * @author unknown
 * @version 1.0
 */
public class MedicalHistoryPresenter { // $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.alwaysOverridetoString.alwaysOverrideToString
	/**
	 * server connection
	 */
	private final ServerConnection sc;

	/**
	 * logged user.
	 */
	private User loggedUser;
	
	/**
	 * Medical History Presenter constructor
	 */
	public MedicalHistoryPresenter(){
		sc = ServerConnection.getInstance();
		loggedUser=sc.getLoggedInUser();
	}
	
	/**
	 * Medical History Presenter constructor that takes in User user
	 * @param user
	 */
	public MedicalHistoryPresenter(User user){
		sc = ServerConnection.getInstance();
		loggedUser=user;
	}
	
	/**
	 * gets logged user
	 * @return loggedUser
	 */
	public User getLoggedUser(){
		return loggedUser;
	}
	
	/**
	 * set logged user 
	 * @param user
	 */
	public void setLoggedUser(User user){
		loggedUser=user;
	}
	
	/**
	 * List of <Appointment>'s
	 * @return appointments for particular user 
	 */
	public List<Appointment> getAppointments(){
		System.out.println("loggeduser = " + loggedUser.getUsername());
		return sc.getAppointmentForUser(loggedUser.getUsername());
	}
}
